<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="shortcut icon" type="image/x-icon" th:href="@{/favicon.ico}" href="../../../../static/favicon.ico"/>
    <link rel="stylesheet" th:href="@{/layui-admin/layui/css/layui.css}" href="../../../../static/layui-admin/layui/css/layui.css" media="all">
    <link rel="stylesheet" th:href="@{/layui-admin/style/admin.css}" href="../../../../static/layui-admin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid">
    <div id="notice-list" class="layui-card">
        <div class="layui-tab layui-tab-brief" lay-filter="notice-tab">
            <ul class="layui-tab-title">
                <li class="layui-icon layui-icon-dialogue layui-this"> 未读<span id="notice-unread"></span></li>
                <li class="layui-icon layui-icon-read"> 已读</li>
                <li class="layui-icon layui-icon-notice" lay-id="all"> 全部</li>
            </ul>
            <div class="layui-tab-content layui-form">
                <table class="layui-hide" id="notice-table" lay-filter="notice-table"></table>
            </div>
        </div>
        <script type="text/html" id="notice-toolbar">
            <div class="layui-btn-group" th:if="${session.admin_session.attrId==1}">
                <button class="layui-btn layui-btn-sm" lay-event="add-toolbar">
                    <i class="layui-icon">&#xe654;</i>添加
                </button>
                <button class="layui-btn layui-btn-normal layui-btn-sm" lay-event="edit-toolbar">
                    <i class="layui-icon">&#xe642;</i>编辑
                </button>
                <button class="layui-btn layui-btn-danger layui-btn-sm" lay-event="del-toolbar">
                    <i class="layui-icon">&#xe640;</i>删除
                </button>
            </div>
            <div class="layui-btn-container" th:if="${session.admin_session.attrId!=1}">
                <button class="layui-btn layui-btn-danger layui-btn-sm" lay-event="del-toolbar">
                    <i class="layui-icon">&#xe640;</i>删除
                </button>
            </div>
        </script>
        <script type="text/html" id="title-tpl">
            <a lay-event="show-tool">{{ d.title }}</a>
        </script>
        <script type="text/html" id="receive-tpl">
            {{# if(d.receiveUser){ }}
            {{ d.receiveUser }}
            {{# }else{ }}
            <span class="layui-badge-rim">全部</span>
            {{# } }}
        </script>
        <script type="text/html" id="status-tpl">
            {{# if(d.statusId === 0){ }}
            <span class="layui-badge layui-bg-red">{{ d.statusExplain }}</span>
            {{# }else if(d.statusId === 1){ }}
            <span class="layui-badge layui-bg-blue">{{ d.statusExplain }}</span>
            {{# }else{ }}
            <span class="layui-badge-rim">{{ d.statusExplain }}</span>
            {{# } }}
        </script>
    </div>
    <!-- 通知公告 -->
    <div id="notice-show"></div>
    <script id="notice-tpl" type="text/html">
        <div class="layui-card layuiAdmin-msg-detail">
            <div class="layui-card-header">
                <h1>{{ d.title }}</h1>
                <p>
                    <span lay-tips="{{ d.createTime }}">时间：{{ layui.util.timeAgo(d.createTime) }}</span>
                    <span>用户：{{ d.createUser }}</span>
                </p>
            </div>
            <div class="layui-card-body layui-text">
                <p>
                    <a href="javascript:;" id="notice-back" class="layui-btn layui-btn-primary layui-btn-sm">返回上级</a>
                </p>
                <div class="layadmin-text">
                    {{ d.content }}
                    <blockquote class="layui-elem-quote">
                        <span lay-tips="{{ d.updateTime||d.createTime }}">时间：{{ layui.util.timeAgo(d.updateTime||d.createTime) }}</span>
                        <span>用户：{{ d.updateUser||d.createUser }}</span>
                        <span>
                            已读：
                            {{# layui.each(d.readMasterUsers, function(index, item){ }}
                            <span class="layui-badge layui-bg-green">{{ item.username }}</span>
                            {{# }); }}
                        </span>
                    </blockquote>
                </div>
            </div>
        </div>
    </script>
</div>
<!-- 表单编辑 -->
<form class="layui-form" id="notice-form" lay-filter="notice-form" style="display: none;">
    <div class="layui-form-item">
        <input type="hidden" id="id" name="id" class="layui-input">
        <input type="text" id="title" name="title" lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
    </div>
    <div class="layui-form-item">
        <textarea id="content" name="content" style="display: none;"></textarea>
    </div>
    <div class="layui-form-item">
        <input type="text" id="receiveUser" name="receiveUser" placeholder="请输入要发送的用户（支持用户名/邮箱/手机号）" autocomplete="off">
    </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="notice-submit" id="notice-submit" value="确认">
    </div>
</form>
<script th:inline="javascript">
    const config = {
        base: /*[[@{/}]]*/ '../../../../static/'
    };
</script>
<script th:src="@{/layui-admin/layui/layui.js}" src="../../../../static/layui-admin/layui/layui.js"></script>
<script th:src="@{/views/admin/master/js/notice.js}" src="../../../../static/views/admin/master/js/notice.js"></script>
</body>
</html>